package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Create with Intellij idea
 * User:鲁智明
 * Date:2018/11/15
 * Time:21:10
 */

@SpringBootApplication
@EnableEurekaClient
public class OrderApp {

    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class,args);
    }

    //解决RestTemplate 找不到的原因 因该把restTemplate注册到spring容器中
    @Bean
   @LoadBalanced  //开启负载均衡
    RestTemplate restTemplate(){
        return  new RestTemplate();
    }

}
